%% getBeatScale
%
% Returns the extracted heart rate and seconds per pixel from an echo
%
%% Synatax
%
% [ secondsPerPixel ] = getBeatScaleGUI ( dicomImg, inputAxes, instructionText )
%
%% Description
%
% An attempt to extract heart rate information from an image is attempted. If
% it fails, user will be prompted to manually enter heart rate data.
%
% User is also prompted to bound a region correlating to a known one second
% interval on the echo (space between two large vertical hash marks) for
% the purpose of correlating time data to positional data. 
%
%% Arguments
%* dicomImg                             - Double: An echo image 
%
%* inputAxes                            - Axes: Axis formatting information
%                                               passed in from GUI
%
%* instructionText                      - UIControl: User interface
%                                                    formatting information
%
%% Returns
%
%* secondsPerPixel                      - Double: The calculated ratio of
%                                                 seconds to pixels in the image
%
%% Function Side Effects
%
%* A figure is displayed
%
%* Text is outputted to the console
%
%* The user is prompted to select points and potentially to enter data
%
%% Exceptions
%
%* N/A
%
%% See Also
% 


function [ secondsPerPixel ] = getBeatScaleGUI ( dicomImg, inputAxes, instructionText )
%UNTITLED5 Summary of this function goes here
%   Detailed explanation goes here

pointOneDisplayString = 'Please select a large hashmark starting a one second interval';
pointTwoDisplayString = 'Please select a large hashmark ending the respective one second interval';

% Prompts the user to select the start and end of a known one second
% interval on the echo. One second intervals used to calibrate X axis scale
% instead of stated heart rate data because stated heart rate is average of
% many beats so may lead to incorrect scaling for single beat of interest.
[ pointOneCoordinates, pointTwoCoordinates ] = selectTwoPoints( dicomImg, ... 
                                                                 pointOneDisplayString, ...
                                                                 pointTwoDisplayString, ...
                                                                 instructionText);
                                                             
                                                          
[ calculatedVector ] = calculateVector(pointOneCoordinates, pointTwoCoordinates);    

[ secondsPerPixel ] = getSecondsPerPixel( 1, calculatedVector(1) );
    
end

